Scheduler for WinRT
Importing Data

There are two ways through which you can load data into your application. Either you can allow users to select what will be imported, or you can handle it silently.

To handle importing data and allow user to select the file to be loaded into the application, use the following code:

C#
Copy Code
// opens Open File (system defined) dialog and allows end-user to select what file should be imported
C1Scheduler.ImportCommand.Execute(null, sched1);

To handle importing data silently, use the following code:

To import data from a local XML or iCal file in the application folder, place the following code in a Load Button click, Page Navigated To or Loaded event.

C#
Copy Code
// Import XML from app local folder
var folder = Windows.Storage.ApplicationData.Current.LocalFolder;
try
{
    var file = await folder.GetFileAsync("appointments.xml");
    IRandomAccessStream stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
    await sched1.DataStorage.ImportAsync(stream.AsStreamForRead(), C1.C1Schedule.FileFormatEnum.XML);
    stream.Dispose();
}
catch { }

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback